package org.kjk.board;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

public class BoardInsertController extends AbstractController {
	private BoardDAOImpl dao;

	@Override
	protected ModelAndView handleRequestInternal(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String subject = request.getParameter("subject");
		String content = request.getParameter("content");
		String writer = request.getParameter("writer");
		System.out.println("call insert board " + " subject : " + subject + " content : " + content);
		BoardDTO bean = new BoardDTO(subject, content, writer);
		dao.insert(bean);
		response.getWriter().println("success");
		return null;
//		return new ModelAndView("검색페이지");
	}

	public void setDao(BoardDAOImpl dao) {
		this.dao = dao;
	}
}
